<template>
    <card class="">
        <card-block class="text-xl leading-tight">
            <a class="no-underline hover:text-black text-90"
               :href="'/repositories/'+repository.id">{{repository.title}}</a>
            <div class="inline-flex flex-wrap"><div v-for="tag in repository.tags" class=" tag">{{tag}}</div></div>
        </card-block>
        <card-block v-if="repository.introduction">{{repository.introduction_substring}}</card-block>
        <card-block class="flex border-b border-t border-50">
            <!--<div class="mr-3">{{repository.issues_count}}评论</div>-->
            <div class="mr-3">{{repository.current_chapters_count}}章</div>
            <div class="mr-3">{{repository.forks_count}}副本</div>
            <div class="mr-3">{{repository.likes_count}}赞</div>
            <div class="mr-3">{{repository.views}}浏览</div>
            <div class="mr-3">{{repository.length}}字</div>
        </card-block>
        <card-block class="text-sm leading-tight text-70 bg-20">
            <template v-if="repository.is_fork">
                由 <a :href="'/users/'+repository.user.id">{{repository.user.name}}</a> 的创建副本
            </template>
            <template v-else-if="repository.user">
                <a :href="'/users/'+repository.user.id">{{repository.user.name}}</a>
            </template>
            <template v-else>匿名作者</template>

            更新于 {{repository.updated_at}}
        </card-block>

    </card>
</template>

<script>
    export default {
        name: "TigRepositoryItem", props: {repository: Object}
    }
</script>
